<?#//v.3.0.0

#///////////////////////////////////////////////////////
#//  COPYRIGHT 2004 Phpauction.org ALL RIGHTS RESERVED//
#///////////////////////////////////////////////////////

require('../includes/config.inc.php');
include "loggedin.inc.php";

if(basename($HTTP_REFERER) != "checkupdates.php") exit;

#// Run script
if(!@mysql_connect("phpauction.org","patches","cantachetipassa")) {
	print "Cannot connect to patches server";
	exit;
} elseif(!mysql_select_db("phpauctionpropatches")) {
	print "Cannot select xlpatches database";
	exit;
} else {
	$query = "SELECT script FROM xlupdates WHERE id=$id";
	$res = mysql_query($query);
	if(!$res) {
		print "Error: $query<BR>".mysql_error();
		exit;
	} elseif(mysql_num_rows($res) > 0) {
		$SCRIPT = mysql_result($res,0,"script");
		eval(stripslashes($SCRIPT));
		
		#// Update local database
		mysql_connect($DbHost,$DbUser,$DbPassword);
		mysql_select_db($DbDatabase);
		$query = "INSERT INTO PHPAUCTIONXL_updates VALUES(
					  $id,
					  '".date("Ymd")."',
					  'ok')";
		$r = @mysql_query($query);
		
		Header("Location: checkupdates.php");
		exit;
	}
}
Header("Location: checkupdates.php");
exit;

?>